package algorithm.classification.io;

import data.factory.OctaveLoader;
import data.vectors.DoubleVector;
import data.vectors.DoubleVectorWritable;
import algorithm.classification.binary.PerceptronLoss_L2Regularized;
import algorithm.classification.binary.parameters.PerceptronParameters;

public class LinearClassifierFromFile {

	private String filename;

	public LinearClassifierFromFile(String filename) {
		super();
		this.filename = filename;
	}
	
	public PerceptronLoss_L2Regularized build(){
		
		
		OctaveLoader ol = new OctaveLoader(filename);
		DoubleVectorWritable w = (DoubleVectorWritable) ol.loadDoubleVectorSparse();
		
		PerceptronLoss_L2Regularized svm = 
			new PerceptronLoss_L2Regularized( new PerceptronParameters());
		
		svm.setWeight(w);
		
		return svm;
	}
}
